using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PhyFlyAction : SSAction
{
    private Vector3 start_vector;                              
    public float power;

    public static PhyFlyAction GetSSAction(int lor, float power) {
        PhyFlyAction action = CreateInstance<PhyFlyAction>();
        action.start_vector = ((lor==1)?Vector3.right * power:Vector3.left * power);
        action.power = power;
        return action;
    }
    public override void FixedUpdate() {

        if (transform.position.y <= -10f) {
            gameobject.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0);
            this.destroy = true;
            this.callback.SSActionEvent(this);
        }
    }
    public override void Start() {
        gameobject.GetComponent<Rigidbody>().AddForce(start_vector*3, ForceMode.Impulse);
    }
    public override void Update() { }
}
